package juc;

/**
 * @program: check-repetition
 * @description:
 * @author: hjk
 * @create: 2021-07-09 17:08
 **/
public class Ticket {

    //票数
    private int number = 30;

    public synchronized void sale() {
        //判断：是否有票
        if(number > 0) {
            System.out.println(Thread.currentThread().getName()+" : "+(number--)+" "+number);
        }
    }
}
